/*******************************************************************************
 * Copyright (c) 2011 Irineu Martins de Lima Moura (imlm2).
 * This file is part of JBeat.
 * 
 *     JBeat is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU Lesser General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 * 
 *     JBeat is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU Lesser General Public License for more details.
 * 
 *     You should have received a copy of the GNU Lesser General Public License
 *     along with JBeat.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * Contributors:
 *     Irineu Martins de Lima Moura (imlm2) - initial API and implementation
 ******************************************************************************/
package br.ufpe.cin.imlm2.jbeat.soot.common;

import java.util.Collection;
import java.util.List;

import soot.SootClass;
import soot.SootMethod;

/**
 * An abstract Tagger of methods.
 * Although its main use is for tagging methods (<code>SootMethod</code>'s) it can also be used
 * to tag bodies (<code>Body</code>) and units (<code>Unit</code>) contained in the methods. 
 * @author Irineu
 *
 */
public abstract class MethodTagger extends Tagger {

	protected MethodTagger(List<String> excludeClasses, List<String> excludePackages,
			boolean rtLibraries) {
		super(excludeClasses,excludePackages,rtLibraries);
	}

	protected MethodTagger(List<String> excludeClasses, List<String> includeClasses,
			List<String> excludePackages, boolean rtLibraries) {
		super(excludeClasses,includeClasses,excludePackages,rtLibraries);
	}
	
	protected void executePostTaggingTransformations(Collection<SootClass> classes) {}

	protected void executePreTaggingTransformations(Collection<SootClass> classes) {}

	protected void generateTags(Collection<SootClass> classes) {
		for (SootClass sootClass : classes) {
			List<SootMethod> methods = sootClass.getMethods();
			for (SootMethod sootMethod : methods) {
				this.checkTags(sootMethod);				
			}
		}
	}
	
	protected abstract void checkTags(SootMethod m);

}
